Programming in Objective-C, Fifth Edition by Stephen G. Kochan

Programming in Objective-C, Fifth Edition by Stephen G. Kochan

Author:Stephen G. Kochan
Language: eng
Format: epub
Publisher: Addison-Wesley
Published: 2013-03-25T16:00:00+00:00


The #import Statement

When you have programmed in Objective-C for a while, you will find yourself developing your own set of macros, which you will want to use in each of your programs. But instead of having to type these macros into each new program you write, the preprocessor enables you to collect all your definitions into a separate file and then include them in your program, using the #import statement. These files—similar to the ones you’ve previously encountered but haven’t written yourself—normally end with the characters .h and are referred to as header or include files.

Suppose that you are writing a series of programs for performing various metric conversions. You might want to set up some #define statements for the various constants you need for performing your conversions:

#define INCHES_PER_CENTIMETER 0.394

#define CENTIMETERS_PER_INCH (1 / INCHES_PER_CENTIMETER)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.